package com.fhz.day007.core;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

/**
 * 时间:2022/5/25
 *
 * @author msfeng
 * 简述: TODO
 */
public abstract class BaseActivity<VM extends BaseViewModel ,DB extends ViewDataBinding> extends AppCompatActivity {

    protected VM mViewModel;
    protected DB mBinding;

    protected abstract int getLayoutId();
    protected abstract void initData();
    protected abstract VM createViewModel();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding =  DataBindingUtil.setContentView(this,getLayoutId());
        mViewModel = createViewModel();
        initData();
    }

}

